The dopus screen command allows you to find out the dimensions of the Opus
display, this can be useful for positioning of listers, viewers, etc, by
using a simple algorithm to provide a position that will fit on screen.
It also returns the current Opus screen name, and will set RC to 5 if
Opus happens to be iconified at the time.
The default size of your listers is also returned.
Example:
/* DopusScreen.dopus5 */
options results
lf = '0a'x
address 'DOPUS.1'
dopus front
dopus screen
if rc = 5 then do
address command 'RequestChoice "Opus is iconified" "OK"'
exit
end
dimensions = result
text = 'The Opus screen name is: 'word(dimensions,1)
dopus request '"'text'" OK'
text = 'The Opus screen is 'word(dimensions,2)' pixels wide'||lf||,
'and 'word(dimensions,3)' high.'
dopus request '"'text'" OK'
text = 'The titlebar is 'word(dimensions,5)' pixels high, and'||lf||,
'it is a 'word(dimensions,4)' bit screen.'
dopus request '"'text'" OK'
x = trunc(word(dimensions,2) / 2) - trunc(word(dimensions,6) / 2)
y = trunc((word(dimensions,3) - word(dimensions,5)) / 2) - trunc(word(dimensions,7) / 2)
position = x'/'y'/'word(dimensions,6)'/'word(dimensions,7)
lister new position
handle = result
text = 'This lister is in the screen centre,',
||lf||'taking the titlebar height into account',
||lf||'and is the default size.'
lister request handle '"'text'" OK'
lister close handle
dopus back
exit
|